# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-imageio
pkgname=('python2-imageio' 'python-imageio')
_pkgname=imageio
pkgver=2.37.0
pkgrel=1
pkgdesc='Python library for reading and writing image data.'
arch=('any')
url='https://pypi.org/project/imageio/#files'
license=('BSD')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('0b27a888c9f8627e47aaad2782de003388ccde35fea7ccb01d1833da19d0d776a4041968b998408d4082b3d7c2ab31024d70f601c61dad8cf15559f7aabef336')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-imageio() {
  depends=('python2-numpy' 'python2-pillow6' 'python2-enum34' 'python2-futures'
           'python2-pathlib')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build

  mv "$pkgdir/usr/bin/${_pkgname}_download_bin" \
    "$pkgdir/usr/bin/${_pkgname}_download_bin2"
  mv "$pkgdir/usr/bin/${_pkgname}_remove_bin" \
    "$pkgdir/usr/bin/${_pkgname}_remove_bin2"
}

package_python-imageio() {
  depends=('python' 'python-numpy' 'python-pillow6')

  cd "$_pkgname-$pkgver"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

